<!DOCTYPE html>
<html>
<head>
<title>友情链接管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<#include "../../../include/resources.html">
<script type="text/javascript">
	var dataGrid;
	var winWidth =  800;
	var winHeight = 600;
	var addTitle = "添加友情链接";
	var addUrl =  "/modules/column/link/linkAddPage.html";
	var editTitle = "编辑友情链接";
	var editUrl =  "/modules/column/link/linkEditPage.html";
	var deleteUrl = "/modules/column/link/linkDelete.html";	//删除记录接口地址
	var cleanUrl = "/modules/system/sconfig/cleanLink.html";//清理缓存
	var addWinParmeters = "'{0}','"+addTitle+"',"+winWidth+","+winHeight+",'"+addUrl+"'";
	
	var deleteWinParmeters = "'{0}','"+deleteUrl+"'";
	$(function() {
		var editIndex = undefined;
		dataGrid = $('#dataGrid').datagrid({
			url : 'linkList.html',
			fit : true,
			fitColumns : true,
			border : false,
			pagination : true,
			idField : 'id',
			pageSize : pageSize,
			pageNums :1,
			pageList : pageList,
			sortName : 'id',
			sortOrder : 'asc',
			checkOnSelect : false,
			selectOnCheck : false,
			nowrap : false,
			singleSelect:true,
			columns : [ [ 			
			{ field: 'id', title: '编号', width: 50,fixed:true, checkbox : false},
			{ field: 'title', title: '链接标题', width: 150, sortable : false},
			{ field: 'url', title: '链接地址', width: 150, sortable : false},
			{ field: 'status', title: '状态', width: 50, sortable:false,
				formatter:function(value, row, index){
					if(value == 0){
						return "隐藏";
					}else if(value == 1){
						return "显示";
					}
					return "";
				}
			},
			{ field: 'type', title: '类型', width: 50, sortable:false,
					formatter:function(value, row, index){
						if(value == 1){
							return "友情链接";
						}
						return "";
					}
			},
			{ field: 'sort', title: '排序', width: 40, sortable:false },
			{ field: 'addTime', title: '添加时间', width: 120,
				formatter: function(value,row,index){
					if (value){
						return getLocalTime(value,4);
					} else {
						return "";
					}
				}
			},{	field : 'action',
					title : '操作',
					fixed: true,
					width :50,
					formatter : function(value, row, index) {
						var str = '';
						str += '<a href="javascript:void(0);" onclick="$.fn.dataGridOptions.editFun('+row.id+',editTitle,winWidth,winHeight,editUrl);" title="'+editTitle+'">编辑</a>';
						return str;
					}
				}] ],
			toolbar : '#toolbar',
			onLoadSuccess : function() {
				$('#searchForm table').show();
				parent.$.messager.progress('close');
			},
			onRowContextMenu : function(e, rowIndex, rowData) {
				e.preventDefault();
				$(this).datagrid('unselectAll').datagrid('uncheckAll');
				$(this).datagrid('selectRow', rowIndex);
				$('#menu').menu('show', {
					left : e.pageX,
					top : e.pageY
				});
			}
		});
	});
</script>
</head>
<body style="padding:0 20px;" >
	<div class="easyui-layout" data-options="fit : true,border : false">
		<div data-options="region:'north',border:false,collapsible:false" id="searchBox">
        	<div class="sLeft">
	            <form id="searchForm">
	            	<input type="text"  name="searchName" class="sInput" placeholder="输入名称/标题进行搜索" autocomplete="off" onkeydown="if(event.keyCode == 13){ $.fn.dataGridOptions.searchFun('#searchForm');return false;}"/><a href="javascript:;" title="查询" class="sBtn" onclick="$.fn.dataGridOptions.searchFun('#searchForm');">查询</a>
	            	<a href="javascript:void(0);" class="reloadIcon" onclick="dataGrid.datagrid('reload');" title="刷新" ><i class="iconfont">&#xe603;</i></a>
	            </form>
            </div>
            <div class="sRight">
				<a onclick="$.fn.dataGridOptions.addFun(-1,addTitle,winWidth,winHeight,addUrl);" href="javascript:void(0);" class="addBtn"><i class="iconfont">&#xe629;</i>添加</a>
				<a onclick="$.fn.formOptions.btnSubFun(clean_cache,cleanUrl,'','')" href="javascript:void(0);" class="addBtn"><i class="iconfont">&#xe603;</i>清理链接缓存</a>
			</div>
		</div>
		<div data-options="region:'center'" style="margin-top:30px;padding-bottom:30px;">
			<table id="dataGrid"></table>
		</div>
	</div>
	<!-- 清理缓存 -->
	<form id="clean_cache"></form>
</body>
</html>
<script src="${theme_dir}/js/search.js"></script>